var Browser=new Object();
Browser.isMozilla=(typeof document.implementation!='undefined')&&(typeof document.implementation.createDocument!='undefined')&&(typeof HTMLDocument!='undefined');
Browser.isIE=window.ActiveXObject?true:false;
Browser.isGecko=navigator.userAgent.indexOf("Gecko")!=-1;
Browser.isOpera=(navigator.userAgent.toLowerCase().indexOf("opera")!=-1);

var http_51ajax=null;
function creRequest()
{
    msxml_progid=['MSXML2.XMLHTTP.3.0','MSXML2.XMLHTTP','Microsoft.XMLHTTP'];
    try
    {
        http_51ajax=new XMLHttpRequest();
    }
    catch(e)
    {
        for(var i=0;i<msxml_progid.length;++i)
        {
            try
            {
                http_51ajax=new ActiveXObject(msxml_progid[i]);
                break;
            }
            catch(e)
            {
            }
        }
    }
}
function gb2utf8(data)
{
    var glbEncode=[];
    gb2utf8_data=data;
    execScript("gb2utf8_data = MidB(gb2utf8_data, 1)","VBScript");
    var t=escape(gb2utf8_data).replace(/%u/g,"").replace(/(.{2})(.{2})/g,"%$2%$1").replace(/%([A-Z].)%(.{2})/g,"@$1$2");
    t=t.split("@");
    var i=0,j=t.length,k;
    while(++i<j)
    {
        k=t[i].substring(0,4);
        if(!glbEncode[k])
        {
            gb2utf8_char=eval("0x"+k);
            execScript("gb2utf8_char = Chr(gb2utf8_char)","VBScript");
            glbEncode[k]=escape(gb2utf8_char).substring(1,6);
        }
        t[i]=glbEncode[k]+t[i].substring(4);
    }
    gb2utf8_data=gb2utf8_char=null;
    return unescape(t.join("%"));
}
function startRequest(method,urlstr,postDatastr,callback)
{
	creRequest();
    if(http_51ajax)
    {
        var url="";
        var poststr="";
        if(method.toUpperCase() =='GET')
        {
            if(urlstr.indexOf("?")>0){
				url = urlstr;
			}else{
				url=urlstr+"?"+postDatastr;
			}
        }
        else if(method.toUpperCase()=='POST')
        {
            url=urlstr;
            poststr=postDatastr;
        }
        http_51ajax.onreadystatechange=function()
        {
            if(http_51ajax.readyState==4&&http_51ajax.status==200)
            {
                if(Browser.isIE)
                {
                    //if(callback)callback(gb2utf8(http_51ajax.responseBody));
					if(callback)callback(http_51ajax.responseText);
                }
                else
                {
                    if(callback)callback(http_51ajax.responseText);
                }
            }
        }
        http_51ajax.open(method,url,true);
        http_51ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
        http_51ajax.send(poststr);
    }
}